home *** CD-ROM | disk | FTP | other *** search
-
- Listing 3: the C program
-
-
- /* program to return random value */
-
- /* random(n,0) returns next random value in sequence */
- /* random(n,s) resets random sequence with new seed s */
-
- pascal random (int size, int seed)
-
- {
- int i; /* define space for integer */
-
- if (seed != 0) srand(seed); /* if seed not equal to 0 then restart */
- /* pseudo random sequence */
- return(rand() % size); /* return random number within range of size */
-
- }
-
-
-